<?php $this->headScript()->appendFile(HTTP_HOST.'/js/site-admin/RegionPages.js'); ?>
<a href="<?=$this->url(array('action' => 'edit', 'addnew' => 1))?>"><?=$this->translate('Добавить город')?></a><br />
<form method="get" action="<?=HTTP_HOST?>/site-admin/city/index?country=<?=$this->country?>">
	<?=$this->translate('Страна')?>: <?=$this->formSelect('country', $this->country, array('onchange' => 'this.form.submit();'), $this->countries);?>
</form>
<br />
<form method="get" action="<?=HTTP_HOST?>/site-admin/city/index?country=<?=$this->country?>&region=<?=$this->region?>">
	<?=$this->translate('Регион')?>: <?=$this->formSelect('region', $this->region, array('onchange' => 'this.form.submit();'), $this->regions);?>
</form>
<br />
<?php if (sizeof($this->cities) > 0) { ?>
<table border="1">
	<?php $i=1; foreach ($this->cities as $k => $v) { ?>
		<tr>
			<td><?=$i++?></td>
			<td><a href="<?=$this->url(array('action' => 'edit', 'id' => $k))?>"><?=$v['Name']?> (<?=$v['ID']?>)</a></td>
			<td><?=$v['active'] == 0 ? $this->translate('Неактивная') : $this->translate('Активная')?></td>
			<td><div id="<?=$v['ID']?>" class="del_ot" rel="<?=$v['Name']?>" ><img src="<?=HTTP_HOST; ?>/images/controll/del.png" alt="" style="position: relative; float: left; cursor: pointer; width: 20px; height: 20px; border: solid 1px;"/></div></td>
		</tr>
	<?php } ?>
</table>
<?php } ?>
<?php if (sizeof($this->cities) > 0 || sizeOf($this->RegionPage)>0) { ?>
<?php $i = 1;?>
<div id="breadscrumbs">Home > Another page > Whatever page > The final Place page</div>
<div id="cat_table_div">
<table id="cat_table">
	<tr class="head">
		<td class="checkbox_td"></td>
		<td><?=$this->translate('Код')?></td>
		<td></td>
		<td><?=$this->translate('Категория')?></td>
		<td class="active_td">-</td>
		<td colspan="2" class="right_angle"></td>
	</tr>
	<tr id="subhead">
		<td class="checkbox_td"><input type="checkbox" class="enable_all"></td>
		<td class="_table_code"><input type="text" name="code" id="code_field" maxlength="10"/></td>
		<td>-</td>
		<td><input type="text" name="search_region" id="search_region" maxlength="255"/></td>
		<td class="active_td">-</td>
		<td colspan="2" class="search_image"><img src="<?=HTTP_HOST; ?>/images/controll/zoom.png" alt="" class="zoom_icon"/></td>
	</tr>
	<?php if (sizeof($this->cities) > 0) { ?>
		<?php foreach ($this->cities as $v) { ?>
			<?php $i++;?>
			<tr class="cl" <?=(!is_int($i/2))?"style='background: #e1e0e0;'":""; ?>>
				<td class="checkbox_td"><input type="checkbox" name="<?=$v['ID']?>" class="news_ch"></td>
				<td class="_table_code"><?=$v['ID']?></td>
				<?php $id = $v['ID']; ?>
				<td class="type_td"><img src="<?=HTTP_HOST; ?>/images/controll/file.png" alt="" class="object_type" id="state-<?=$v['ID']?>"/></td>
				<td class="_table_title"><?=$v['Name']?></td>
				<td class="active_td"><img src="<?=HTTP_HOST; ?>/images/controll/<?=$v['active'] == 0 ? 'inactive.png' : 'active.png'?>" alt="" class="state" id="state-<?=$v['ID']?>" title="<?=$v['active'] == 0 ? $this->translate('Не активный') : $this->translate('Активный')?>"/></td>
				<td class="edit_td"><a href="<?=$this->url(array('controller' => 'city', 'action' => 'edit', 'id' => $v['ID']), null, false)?>"><img src="<?=HTTP_HOST; ?>/images/controll/edit.png" alt="" class="ed-del-btn" title="<?=$this->translate('Редактировать новость')?>"/></a></td>
				<td class="del_td"><div id="<?=$v['ID']?>" class="del_news" rel="<?=$v['Title']?>" ><img src="<?=HTTP_HOST; ?>/images/controll/delete.png" alt=""  class="ed-del-btn" title="<?=$this->translate('Удалить новость')?>"/></div></td>
			</tr>
		<?php } ?>
	<?php } ?>
	<?php if(sizeOf($this->RegionPage)>0):?>
		<?php foreach ($this->RegionPage as $k => $v) { $i++;?>
			<tr class="cl" <?=(!is_int(($i)/2))?"style='background: #e1e0e0;'":""; ?>>
				<td class="checkbox_td"><input type="checkbox" name="<?=$v['ID']?>" class="r_page_ch"></td>
				<td class="_table_code"><?=$v['ID']?></td>
				<?php $id = $v['ID']; ?>
				<td class="type_td"><img src="<?=HTTP_HOST; ?>/images/controll/file.png" alt="" class="object_type" id="state-<?=$v['ID']?>"/></td>
				<td class="_table_title"><?=$v['Title']?></td>
				<td class="active_td"><img src="<?=HTTP_HOST; ?>/images/controll/<?=$v['active'] == 0 ? 'inactive.png' : 'active.png'?>" alt="" class="page_state" id="state-<?=$v['ID']?>"/></td>
				<td class="edit_td"><a href="<?=$this->url(array('controller'=>'region-page','action' => 'edit', 'id' => $k))?>"><img src="<?=HTTP_HOST; ?>/images/controll/edit.png" alt="" class="ed-del-btn" title="<?=$this->translate('Редактировать страницу')?>"/></a></td>
				<td class="del_td"><div id="<?=$v['ID']?>" class="del_rp" rel="<?=$v['Title']?>" ><img src="<?=HTTP_HOST; ?>/images/controll/delete.png" alt=""  class="ed-del-btn" title="<?=$this->translate('Удалить страницу')?>"/></div></td>
			</tr>
		<?php } ?>	
	<?php endif;?>
	<tr class="table_footer cl">
		<td id="ch" class="checkbox_td"><input type="checkbox" class="enable_all"></td>
		<td colspan="6" id="footer_ico"><div id="group_delete"><img src="<?=HTTP_HOST; ?>/images/controll/delete.png" alt=""  class="ed-del-btn"/><div id="delete_label"><?=$this->translate('Удалить')?></div></div>
		<div id="_add_new_object_div"><a href="<?=$this->url(array('controller' => 'region-page', 'action' => 'edit', 'addnew' => 1))?>"><img src="<?=HTTP_HOST;?>/images/admin-side/add.png" alt="" class="add_sign"/><?=$this->translate('Добавить город')?></a></div>
		</td>
	</tr>
</table>
<div id="table_shadow"></div>
</div>
<?php } else {?>
	<div id="_add_new_object_div"><a href="<?=$this->url(array('controller' => 'region-page', 'action' => 'edit', 'addnew' => 1))?>"><img src="<?=HTTP_HOST;?>/images/admin-side/add.png" alt="" class="add_sign"/><?=$this->translate('Добавить новость')?></a></div>
<?php }?>